class Stack:
    def __init__(self):
        self.items = []

    def push(self, item):
        self.items.append(item)

    def pop(self):
        if not self.is_empty():
            return self.items.pop()
        return None

    def is_empty(self):
        return len(self.items) == 0

def decimal_to_binary(decimal):
    """十进制转二进制（除2取余法，栈存储余数）"""
    if decimal == 0:
        return "0"
    stack = Stack()
    while decimal > 0:
        remainder = decimal % 2  # 取余数
        stack.push(remainder)    # 余数入栈
        decimal = decimal // 2   # 商继续参与运算
    binary = ""
    # 出栈拼接二进制字符串
    while not stack.is_empty():
        binary += str(stack.pop())
    return binary

# 测试
if __name__ == "__main__":
    print(decimal_to_binary(10))  # 输出: 1010
    print(decimal_to_binary(0))   # 输出: 0
    print(decimal_to_binary(7))   # 输出: 111